#!/bin/bash

#eval $(xdotool getdisplaygeometry --shell)

ses="irssi"
session=$(screen -ls | grep $ses)
if [ -z "$session" ]; then
    screen -dmS $ses irssi
    olv init $ses
    exit
fi

case "$session" in
    *Detached*)
	sleep 2 && olv init $ses &
	screen -mddr $ses
	exit
    ;;
esac

#set first frame
screen -S $ses -X split
screen -S $ses -X focus down
#set second frame
screen -S $ses -X screen 1
screen -S $ses -p 1 -X stuff "mosh -4 transadvice.org -- screen -ddr^M"
screen -S $ses -X focus up
sleep 20
screen -S $ses -p 0 -X stuff "/join #randomaware-staff^M"
